﻿
Public Class AMet
    Private m_Location As New Location '位置
    Private m_ArrayMetData(-1) As StructureGeneralMet  '常规气象数组，用于储存常规气象数据
    Private p As Integer = 0 '记数器

    ''' <summary>
    ''' '指定哪个月有多少天
    ''' </summary>
    ''' <remarks></remarks>
    Private mDay As Integer = 0
    Private mYear As Integer = 0
    Private mMoon As Integer = 0
    ''' <summary>
    ''' 气象站信息
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property Location() As Location '位置
        Get
            Return m_Location
        End Get
        Set(ByVal value As Location)
            m_Location = value
        End Set
    End Property

    ''' <summary>
    ''' 常规气象数组，用于储存常规气象数据
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property ArrayMetData() As StructureGeneralMet()
        Get
            Return Me.m_ArrayMetData
        End Get
        Set(ByVal value As StructureGeneralMet())
            Me.m_ArrayMetData = value
        End Set
    End Property

    ''' <summary>
    ''' 从指定文件中导入常规气象数据
    ''' </summary>
    ''' <param name="filename"></param>
    ''' <remarks></remarks>
    Public Sub LoadMetData(ByVal filename As String)
        Dim strLine As String = ""
        FileOpen(1, filename, OpenMode.Input) '打开文件
        strLine = LineInput(1) '读取第一行
        mMoon = CInt(StringHandle.GetString(strLine, 12)) '得到日期中的月份
        mYear = CInt(StringHandle.GetString(strLine, 11)) '得到日期中的年份
        '判断指定月有多少天
        If mMoon = 2 Then
            If mYear Mod 400 = 0 Or (mYear Mod 4 = 0 And mYear Mod 100 <> 0) Then
                mDay = 29 '29天
            Else
                mDay = 28  '28天
            End If
        End If
        If mMoon = 1 Or mMoon = 3 Or mMoon = 5 Or mMoon = 7 Or mMoon = 8 Or mMoon = 10 Or mMoon = 12 Then
            mDay = 31 '31天
        End If
        If mMoon = 4 Or mMoon = 6 Or mMoon = 9 Or mMoon = 11 Then
            mDay = 30 '30天
        End If
        FileClose(1) '关闭文件

        Dim mDatetime As New System.DateTime(mYear, mMoon, 1, 21, 0, 0) '读到的文件中的时间
        Dim SDatetime As DateTime '开始时间
        Dim EDatetime As New System.DateTime(mYear, mMoon, mDay, 20, 0, 0) '结束时间
        SDatetime = mDatetime.AddDays(-1) '前一天的时间
        ResetArrayMetData(SDatetime, EDatetime)
        Information(filename)    '站台信息
        Try
            StopP(filename)          '站点气压
        Catch ex As Exception
            MsgBox("读取该文件的观测站地面气压数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try
        Try
            SeaPlaneP(filename)      '海平面气压
        Catch ex As Exception
            MsgBox("读取该文件的海平面气压数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try
        Try
            TB(filename)             '气温
        Catch ex As Exception
            MsgBox("读取该文件的干球温度数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try
        Try
            IB(filename)             '湿球温度
        Catch ex As Exception
            MsgBox("读取该文件的湿球温度数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try
        Try
            TD(filename)             '露点温度
        Catch ex As Exception
            MsgBox("读取该文件的露点温度数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try
        Try
            UB(filename)             '相对温度
        Catch ex As Exception
            MsgBox("读取该文件的相对温度数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try
        Try
            N9(filename)             '云量
        Catch ex As Exception
            MsgBox("读取该文件的云量数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try

        Try
            V9(filename)         '可见度
        Catch ex As Exception
            FileClose(1)
        End Try
        Try
            FN(filename)             '风
        Catch ex As Exception
            MsgBox("读取该文件的风的数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try
        Try
            RX(filename)         '降水
        Catch ex As Exception
            MsgBox("读取该文件的降水量数据错误，请与作者联系！", MsgBoxStyle.Question, "提示")
            FileClose(1)
        End Try

    End Sub
    ''' <summary>
    ''' 站台信息
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub Information(ByVal FileName As String)
        Dim strLine As String = ""
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        strLine = LineInput(1) '读取一行
        Me.m_Location.SiteId = strLine.Substring(0, 5)
        Me.m_Location.Latitude.Number = strLine.Substring(6, 2) + strLine.Substring(8, 2) / 60
        If strLine.Substring(10, 1) = "N" Then
            Me.m_Location.Latitude.Dir = 0
        ElseIf strLine.Substring(10, 1) = "S" Then
            Me.m_Location.Latitude.Dir = 1
        End If
        Me.m_Location.Longitude.Number = strLine.Substring(12, 3) + strLine.Substring(15, 2) / 60
        If strLine.Substring(17, 1) = "E" Then
            Me.m_Location.Longitude.Dir = 0
        ElseIf strLine.Substring(17, 1) = "W" Then
            Me.m_Location.Longitude.Dir = 1
        End If
        FileClose(1)
    End Sub

    ''' <summary>
    ''' 本站气压的处理
    ''' </summary>
    ''' <param name="FileName"></param>
    ''' <remarks></remarks>
    Private Sub StopP(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        Dim mMode As String = "" '方式位
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1) = "P=" Then
                    Exit Do       '全月缺测
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "P" And StringHandle.GetString(strLine, 1).Length = 2 Then
                    mPointCode = "P"
                    mMode = Mid(StringHandle.GetString(strLine, 1), 2, 1)
                    Continue Do
                End If
                '方式位为“C”时
                If mPointCode = "P" And mEndChar <> "=" Then
                    '不规责的情况
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If
                    If mMode = "C" Then
                        For i As Integer = 1 To 12
                            If StringHandle.GetString(strLine, i) = "////" Then

                            ElseIf StringHandle.GetString(strLine, i) = "////=" Then
                                Exit Do
                            Else
                                Me.m_ArrayMetData(p).m_NowPressure = StringHandle.GetString(strLine, i)
                            End If
                            If m_ArrayMetData(p).m_NowPressure <> 99999 And m_ArrayMetData(p).m_NowPressure < 1000 Then
                                m_ArrayMetData(p).m_NowPressure = m_ArrayMetData(p).m_NowPressure + 10000
                            End If
                            p = p + 1
                        Next
                        '判断是否有“＝”
                        If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                            Exit Do
                        End If
                    End If

                    '每天4次定时观测
                    If mMode = "3" Then
                        If strLine = "=" Then
                            Exit Do
                        End If
                        For i As Integer = 0 To 23
                            If m_ArrayMetData(p).m_DateTime.Hour = 2 Then

                                If StringHandle.GetString(strLine, 1) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_NowPressure = StringHandle.GetString(strLine, 1)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 2) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_NowPressure = StringHandle.GetString(strLine, 2)
                                End If
                            End If
                            If m_ArrayMetData(i).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 3) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_NowPressure = StringHandle.GetString(strLine, 3)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 4) = "////=" Then
                                   
                                ElseIf StringHandle.GetString(strLine, 4) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_NowPressure = StringHandle.GetString(strLine, 4)
                                End If
                            End If
                            '转换格式
                            If m_ArrayMetData(p).m_NowPressure <> 99999 And m_ArrayMetData(p).m_NowPressure < 1000 Then
                                m_ArrayMetData(p).m_NowPressure = m_ArrayMetData(p).m_NowPressure + 10000
                            End If
                            'If Mid(StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)), 5, 1) = "=" Then
                            '    Exit Do
                            'End If
                            p = p + 1
                        Next
                        '判断是否有“＝”
                        If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                            Exit Do
                        End If
                    End If

                    If mMode = "B" Then
                        For i As Integer = 1 To 12
                            If StringHandle.GetString(strLine, i) = "////" Then

                            ElseIf StringHandle.GetString(strLine, i) = "////=" Then
                                Exit Do
                            Else
                                Me.m_ArrayMetData(p).m_NowPressure = StringHandle.GetString(strLine, i)
                            End If
                            If m_ArrayMetData(p).m_NowPressure <> 99999 And m_ArrayMetData(p).m_NowPressure < 1000 Then
                                m_ArrayMetData(p).m_NowPressure = m_ArrayMetData(p).m_NowPressure + 10000
                            End If
                            p = p + 1
                        Next
                        '判断是否有“＝”
                        If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                            Exit Do
                        End If
                    End If
                End If
            End If
        Loop
        FileClose(1)
    End Sub
    ''' <summary>
    ''' 海平面气压
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub SeaPlaneP(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        Dim Tcount As Integer = 0 '计数器
        Dim mMode As String = "" '方式位
        Dim mCheckSeaPlane As Boolean = False '判断是否为海平面气压

        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1) = "P=" Then
                    Exit Do       '全月缺测
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "P" And StringHandle.GetString(strLine, 1).Length = 2 Then
                    mPointCode = "P"
                    mMode = Mid(StringHandle.GetString(strLine, 1), 2, 1)
                    Continue Do
                End If

                '方式位为“C”时
                If mPointCode = "P" And mCheckSeaPlane = True Then
                    '不规责的情况
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If
                    If mMode = "C" Then  '每天4次定时观测
                        If strLine = "=" Then '此处判断是否有海平面气压
                            Exit Do
                        End If
                        For i As Integer = 0 To 23
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 2 Then '分成4组,当某个定点时间时执行
                                If StringHandle.GetString(strLine, 1).Substring(0, 4) = "////" Then
                                Else
                                    m_ArrayMetData(Tcount).m_SeaPressure = StringHandle.GetString(strLine, 1).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 4) = "////" Then
                                Else
                                    m_ArrayMetData(Tcount).m_SeaPressure = StringHandle.GetString(strLine, 2).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 4) = "////" Then
                                Else
                                    m_ArrayMetData(Tcount).m_SeaPressure = StringHandle.GetString(strLine, 3).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 4).Substring(0, 4) = "////" Then
                                Else
                                    m_ArrayMetData(Tcount).m_SeaPressure = StringHandle.GetString(strLine, 4).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_SeaPressure <> 99999 And m_ArrayMetData(Tcount).m_SeaPressure < 1000 Then
                                m_ArrayMetData(Tcount).m_SeaPressure = m_ArrayMetData(Tcount).m_SeaPressure + 10000
                            End If
                            Tcount = Tcount + 1
                        Next
                        '判断是否有“＝”
                        If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                            Exit Do
                        End If
                    End If
                    'PB
                    If mMode = "B" Then  '每天4次定时观测
                        If strLine = "=" Then '此处判断是否有海平面气压
                            Exit Do
                        End If
                        For i As Integer = 0 To 23
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 2 Then '分成4组,当某个定点时间时执行
                                If StringHandle.GetString(strLine, 1).Substring(0, 4) = "////" Then
                                Else
                                    m_ArrayMetData(Tcount).m_SeaPressure = StringHandle.GetString(strLine, 1).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 4) = "////" Then
                                Else
                                    m_ArrayMetData(Tcount).m_SeaPressure = StringHandle.GetString(strLine, 2).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 4) = "////" Then
                                Else
                                    m_ArrayMetData(Tcount).m_SeaPressure = StringHandle.GetString(strLine, 3).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 4).Substring(0, 4) = "////" Then
                                Else
                                    m_ArrayMetData(Tcount).m_SeaPressure = StringHandle.GetString(strLine, 4).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_SeaPressure <> 99999 And m_ArrayMetData(Tcount).m_SeaPressure < 1000 Then
                                m_ArrayMetData(Tcount).m_SeaPressure = m_ArrayMetData(Tcount).m_SeaPressure + 10000
                            End If
                            Tcount = Tcount + 1
                        Next
                        '判断是否有“＝”
                        If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                            Exit Do
                        End If
                    End If
                End If
                '判断是否为海平面气压
                If mPointCode = "P" Then
                    If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                        mCheckSeaPlane = True
                    End If
                End If
            End If

            '判断A文体的数据观测部分是否结束
            If StringHandle.GetString(strLine, 1) = "??????" Then
                Exit Do
            End If
        Loop
        FileClose(1)
    End Sub

    ''' <summary>
    ''' 气温TB
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub TB(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        p = 0
        Dim mMode As String = "" '方式位的表示形式
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "T" Then
                    mPointCode = "T"
                    mMode = Mid(StringHandle.GetString(strLine, 1), 2, 1)
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "I" Then
                    Exit Do
                End If
                If mPointCode = "T" And mEndChar <> "=" Then
                    '不规责的情况
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If
                    'TB
                    If mMode = "B" Then
                        For i As Integer = 1 To 12
                            If StringHandle.GetString(strLine, i) = "////" Then
                            ElseIf StringHandle.GetString(strLine, i) = "////=" Then
                                Exit Do
                            Else
                                Me.m_ArrayMetData(p).m_DryTemp = StringHandle.GetString(strLine, i)
                            End If
                            p = p + 1
                        Next
                    End If
                    'T0
                    If mMode = "0" Then
                        For i As Integer = 0 To 23
                            If m_ArrayMetData(p).m_DateTime.Hour = 2 Then
                                If StringHandle.GetString(strLine, 1).Substring(0, 4) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_DryTemp = StringHandle.GetString(strLine, 1).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 4) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_DryTemp = StringHandle.GetString(strLine, 2).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 4) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_DryTemp = StringHandle.GetString(strLine, 3).Substring(0, 4)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 4).Substring(0, 4) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_DryTemp = StringHandle.GetString(strLine, 4).Substring(0, 4)
                                End If
                            End If
                            p = p + 1
                        Next
                    End If
                    'TA
                    If mMode = "A" Then
                        For i As Integer = 1 To 12
                            If StringHandle.GetString(strLine, i) = "////" Then
                            ElseIf StringHandle.GetString(strLine, i) = "////=" Then
                                Exit Do
                            Else
                                Me.m_ArrayMetData(p).m_DryTemp = StringHandle.GetString(strLine, i)
                            End If
                            p = p + 1
                        Next
                    End If
                End If
            End If
        Loop
        FileClose(1)
    End Sub
    ''' <summary>
    ''' 湿球温度--------------------IB-----------------
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub IB(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        p = 0
        Dim mMode As String = "" '方式位
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                '气温-------------------------TB-------------------
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "I" Then
                    mPointCode = "I"
                    mMode = Mid(StringHandle.GetString(strLine, 1), 2, 1)
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "=" And mPointCode = "I" Then
                    Exit Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "E" Then
                    Exit Do
                End If
                If mPointCode = "I" And mMode = "B" Then
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If
                    For i As Integer = 1 To 12
                        If StringHandle.GetString(strLine, i) = "////" Or StringHandle.GetString(strLine, i) = "////." Or StringHandle.GetString(strLine, i) = "////=" Then

                        ElseIf StringHandle.GetString(strLine, i).Contains(",") Then
                            'Me.m_ArrayMetData(p).m_WetTemp = 0
                            Me.m_ArrayMetData(p).m_WetTemp = "-" & Mid(StringHandle.GetString(strLine, i).Remove(0, 1), 1, 3)
                        ElseIf StringHandle.GetString(strLine, i) = ",,,," Then
                            Me.m_ArrayMetData(p).m_WetTemp = -10
                        Else
                            Me.m_ArrayMetData(p).m_WetTemp = Mid(StringHandle.GetString(strLine, i), 1, 4)
                        End If
                        '判断是否有“＝”
                        If StringHandle.GetString(strLine, i).Contains("=") Then
                            Exit Do
                        End If
                        p = p + 1
                    Next
                End If
                '方式位为7时
                If mPointCode = "I" And mMode = "7" Then
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    For i As Integer = 0 To 23
                        '8时
                        If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                            If Mid(StringHandle.GetString(strLine, 1), 1, 1) = "," And Mid(StringHandle.GetString(strLine, 1), 1, 2) <> ",," Then
                                Me.m_ArrayMetData(p).m_WetTemp = "-" & StringHandle.GetString(strLine, 1).Remove(0, 1)
                            ElseIf StringHandle.GetString(strLine, 1) = ",,,," Then
                                Me.m_ArrayMetData(p).m_WetTemp = -10
                            ElseIf StringHandle.GetString(strLine, 1) = "////" Then

                            Else
                                Me.m_ArrayMetData(p).m_WetTemp = StringHandle.GetString(strLine, 1)
                            End If
                        End If
                        '14时
                        If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                            If Mid(StringHandle.GetString(strLine, 2), 1, 1) = "," And Mid(StringHandle.GetString(strLine, 2), 1, 2) <> ",," Then
                                Me.m_ArrayMetData(p).m_WetTemp = "-" & StringHandle.GetString(strLine, 2).Remove(0, 1)
                            ElseIf StringHandle.GetString(strLine, 2) = ",,,," Then
                                Me.m_ArrayMetData(p).m_WetTemp = -10
                            ElseIf StringHandle.GetString(strLine, 2) = "////" Then
                            Else
                                Me.m_ArrayMetData(p).m_WetTemp = StringHandle.GetString(strLine, 2)
                            End If
                        End If
                        '20时
                        If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                            If Mid(StringHandle.GetString(strLine, 3), 1, 1) = "," And Mid(StringHandle.GetString(strLine, 3), 1, 2) <> ",," Then
                                Me.m_ArrayMetData(p).m_WetTemp = "-" & Mid(StringHandle.GetString(strLine, 3), 1, 4).Remove(0, 1)
                            ElseIf Mid(StringHandle.GetString(strLine, 3), 1, 4) = ",,,," Then
                                Me.m_ArrayMetData(p).m_WetTemp = -10
                            ElseIf StringHandle.GetString(strLine, 3) = "////" Then
                            Else
                                Me.m_ArrayMetData(p).m_WetTemp = Mid(StringHandle.GetString(strLine, 3), 1, 4)
                            End If
                        End If
                        p = p + 1
                    Next
                    '判断是否有“＝”
                    If Mid(StringHandle.GetString(strLine, 3), StringHandle.GetString(strLine, 3).Length, 1) = "=" Then
                        Exit Do
                    End If
                End If
            End If
        Loop
        FileClose(1)
    End Sub

    ''' <summary>
    ''' 露点温度－－－－－－－－－－－－－－－－－－－TD－－－－－－－
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub TD(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        Dim mMode As String = "" '方式位标志
        Dim mCheckDewpoint As Boolean = False '判断是否为露点温度
        p = 0
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine = "" And mPointCode = "I" Then
                Exit Do
            End If
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "I" Then
                    mPointCode = "I"
                    mMode = Mid(StringHandle.GetString(strLine, 1), 2, 1) '得到某种方式位
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "=" And mPointCode = "I" Then
                    mCheckDewpoint = True
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "E" Then
                    Exit Do
                End If

                If mCheckDewpoint = True Then
                    '当方式位为"B"的时候
                    If mPointCode = "I" And mMode = "B" Then
                        For i As Integer = 1 To 12
                            If StringHandle.GetString(strLine, i).Substring(0, 4) = "////" Then
                            Else
                                Me.m_ArrayMetData(p).m_DewTemp = StringHandle.GetString(strLine, i).Substring(0, 4)
                            End If
                            p = p + 1
                        Next
                        '判断是否有“＝”
                        If Mid(StringHandle.GetString(strLine, 12), StringHandle.GetString(strLine, 12).Length, 1) = "=" Then
                            Exit Do
                        End If
                    End If
                    '当方式位为"7"的时候
                    If mPointCode = "I" And mMode = "7" Then
                        For i As Integer = 0 To 23
                            '2时
                            If m_ArrayMetData(p).m_DateTime.Hour = 2 Then
                                If StringHandle.GetString(strLine, 1).Substring(0, 4) = "////" Then
                                    Me.m_ArrayMetData(p).m_DewTemp = 999
                                Else
                                    Me.m_ArrayMetData(p).m_DewTemp = StringHandle.GetString(strLine, 1).Substring(0, 4)
                                End If
                            End If
                            '8时
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 4) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_DewTemp = StringHandle.GetString(strLine, 2).Substring(0, 4)
                                End If
                            End If
                            '14时
                            If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 4) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_DewTemp = StringHandle.GetString(strLine, 3).Substring(0, 4)
                                End If
                            End If
                            '20时
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 4).Substring(0, 4) = "////" Then
                                Else
                                    Me.m_ArrayMetData(p).m_DewTemp = StringHandle.GetString(strLine, 4).Substring(0, 4)
                                End If
                            End If
                            p = p + 1
                        Next
                        '判断是否有“＝”
                        If Mid(StringHandle.GetString(strLine, 4), StringHandle.GetString(strLine, 4).Length, 1) = "=" Then
                            Exit Do
                        End If
                    End If
                End If
                '是否为露点温度的数据
                If mPointCode = "I" Then
                    If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                        mCheckDewpoint = True
                        Continue Do
                    End If
                End If
            End If
        Loop
        FileClose(1)
    End Sub
    ''' <summary>
    ''' 相对湿度--------------UB-----------------
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub UB(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        Dim mMode As String = "" '方式位标志
        p = 0
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "U" Then
                    mPointCode = "U"
                    mMode = Mid(StringHandle.GetString(strLine, 1), 2, 1) '得到某种方式位
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "N" Then
                    Exit Do
                End If
                '方式位为“B”时
                If mPointCode = "U" And mEndChar <> "=" Then
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If
                    If mMode = "B" Then
                        For i As Integer = 1 To 12
                            If StringHandle.GetString(strLine, i) = "//" Then

                            ElseIf StringHandle.GetString(strLine, i) = "%%" Then
                                Me.m_ArrayMetData(p).m_Humidity = 100
                            Else
                                Me.m_ArrayMetData(p).m_Humidity = StringHandle.GetString(strLine, i)
                            End If
                            p = p + 1
                        Next
                    End If
                    '方式位为“0”时
                    If mMode = "0" Then
                        For i As Integer = 0 To 23
                            '2时
                            If m_ArrayMetData(p).m_DateTime.Hour = 2 Then
                                If StringHandle.GetString(strLine, 1) = "%%" Then
                                    Me.m_ArrayMetData(p).m_Humidity = 100
                                ElseIf StringHandle.GetString(strLine, 1) = "//" Then
                                Else
                                    Me.m_ArrayMetData(p).m_Humidity = StringHandle.GetString(strLine, 1)
                                End If
                            End If
                            '8时
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 2) = "%%" Then
                                    Me.m_ArrayMetData(p).m_Humidity = 100
                                ElseIf StringHandle.GetString(strLine, 2) = "//" Then
                                Else
                                    Me.m_ArrayMetData(p).m_Humidity = StringHandle.GetString(strLine, 2)
                                End If
                            End If
                            '14时
                            If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 3) = "%%" Then
                                    Me.m_ArrayMetData(p).m_Humidity = 100
                                ElseIf StringHandle.GetString(strLine, 3) = "//" Then
                                Else
                                    Me.m_ArrayMetData(p).m_Humidity = StringHandle.GetString(strLine, 3)
                                End If
                            End If
                            '20时
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                If Mid(StringHandle.GetString(strLine, 4), 1, 2) = "%%" Then
                                    Me.m_ArrayMetData(p).m_Humidity = 100
                                ElseIf StringHandle.GetString(strLine, 4) = "//" Then
                                Else
                                    Me.m_ArrayMetData(p).m_Humidity = Mid(StringHandle.GetString(strLine, 4), 1, 2)
                                End If
                            End If
                            p = p + 1
                        Next
                    End If
                    'UA
                    If mMode = "A" Then
                        For i As Integer = 1 To 12
                            If StringHandle.GetString(strLine, i) = "//" Then

                            ElseIf StringHandle.GetString(strLine, i) = "%%" Then
                                Me.m_ArrayMetData(p).m_Humidity = 100
                            Else
                                Me.m_ArrayMetData(p).m_Humidity = StringHandle.GetString(strLine, i)
                            End If
                            p = p + 1
                        Next
                    End If
                    '判断是否有“＝”
                    If Mid(StringHandle.GetString(strLine, 4), StringHandle.GetString(strLine, 4).Length, 1) = "=" Then
                        Exit Do
                    End If
                End If
            End If
        Loop
        FileClose(1)
    End Sub
    ''' <summary>
    ''' 云量------------------N9--------------------
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub N9(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        Dim mSeaPoint As String = "" '海平面气压标志
        Dim Tcount As Integer = 0 '计数器
        Dim mStrIndexN As String = "" '哪一种方式位

        p = 0
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "N" Then
                    mPointCode = "N"
                    mStrIndexN = Mid(StringHandle.GetString(strLine, 1), 2, 1)
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "H" Or StringHandle.GetString(strLine, 1).Substring(0, 1) = "F" Then
                    Exit Do
                End If
                If mPointCode = "N" And mEndChar <> "=" Then
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If

                    For i As Integer = 0 To 23
                        If mStrIndexN = "9" Then
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 1).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(p).m_TotalCloud = StringHandle.GetString(strLine, 1).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(p).m_TotalCloud = StringHandle.GetString(strLine, 2).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(p).m_TotalCloud = StringHandle.GetString(strLine, 3).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(p).m_TotalCloud = 11 Then '如果云量11设置为10
                                m_ArrayMetData(p).m_TotalCloud = 10
                            End If
                        End If
                        If mStrIndexN = "0" Then
                            If m_ArrayMetData(p).m_DateTime.Hour = 2 Then
                                If StringHandle.GetString(strLine, 1).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(p).m_TotalCloud = StringHandle.GetString(strLine, 1).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(p).m_TotalCloud = StringHandle.GetString(strLine, 2).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(p).m_TotalCloud = StringHandle.GetString(strLine, 3).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 4).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(p).m_TotalCloud = StringHandle.GetString(strLine, 4).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(p).m_TotalCloud = 11 Then '如果云量11设置为10
                                m_ArrayMetData(p).m_TotalCloud = 10
                            End If
                        End If
                        If mStrIndexN = "A" Then
                            If StringHandle.GetString(strLine, i + 1).Substring(0, 2) = "//" Then
                            Else
                                m_ArrayMetData(p).m_TotalCloud = StringHandle.GetString(strLine, i + 1).Substring(0, 2)
                            End If
                            If m_ArrayMetData(p).m_TotalCloud = 11 Then '如果云量11设置为10
                                m_ArrayMetData(p).m_TotalCloud = 10
                            End If
                        End If
                        p = p + 1
                    Next
                    If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Length > 2 Then
                        If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Substring(2, 1) = "=" Then
                            mEndChar = "="
                            mSeaPoint = "N99"
                            Continue Do
                        End If
                    End If
                End If
                ''-------------------------N9-----------         
                If mPointCode = "N" And mSeaPoint = "N99" Then
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If

                    For i As Integer = 0 To 23
                        If mStrIndexN = "9" Then
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 1).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(Tcount).m_LowCloud = StringHandle.GetString(strLine, 1).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(Tcount).m_LowCloud = StringHandle.GetString(strLine, 2).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(Tcount).m_LowCloud = StringHandle.GetString(strLine, 3).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_LowCloud = 11 Then
                                m_ArrayMetData(Tcount).m_LowCloud = 10 '如果云量11设置为10
                            End If
                        End If
                        If mStrIndexN = "0" Then
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 2 Then
                                If StringHandle.GetString(strLine, 1).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(Tcount).m_LowCloud = StringHandle.GetString(strLine, 1).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(Tcount).m_LowCloud = StringHandle.GetString(strLine, 2).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(Tcount).m_LowCloud = StringHandle.GetString(strLine, 3).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 4).Substring(0, 2) = "//" Then
                                Else
                                    m_ArrayMetData(Tcount).m_LowCloud = StringHandle.GetString(strLine, 4).Substring(0, 2)
                                End If
                            End If
                            If m_ArrayMetData(Tcount).m_LowCloud = 11 Then
                                m_ArrayMetData(Tcount).m_LowCloud = 10 '如果云量11设置为10
                            End If
                        End If
                        If mStrIndexN = "A" Then
                            If StringHandle.GetString(strLine, i + 1).Substring(0, 2) = "//" Then
                            Else
                                m_ArrayMetData(Tcount).m_LowCloud = StringHandle.GetString(strLine, i + 1).Substring(0, 2)
                            End If
                            If m_ArrayMetData(Tcount).m_LowCloud = 11 Then
                                m_ArrayMetData(Tcount).m_LowCloud = 10 '如果云量11设置为10
                            End If
                        End If
                        Tcount = Tcount + 1
                    Next
                End If
            End If
        Loop
        FileClose(1)
    End Sub
    ''' <summary>
    ''' 可见度----------------------V9---------------------
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub V9(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        Dim mMode As String = "" '方式位
        p = 0
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "V" Then
                    mPointCode = "V"
                    mMode = StringHandle.GetString(strLine, 1).Substring(1, 1)
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "R" Then
                    Exit Do
                End If
                If mPointCode = "V" And mEndChar <> "=" Then
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If
                    If mMode = "9" Then
                        For i As Integer = 0 To 23
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                If StringHandle.GetString(strLine, 1).Substring(0, 3) = "///" Then
                                Else
                                    m_ArrayMetData(p).m_Visibility = StringHandle.GetString(strLine, 1).Substring(0, 3)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                                If StringHandle.GetString(strLine, 2).Substring(0, 3) = "///" Then
                                Else
                                    m_ArrayMetData(p).m_Visibility = StringHandle.GetString(strLine, 2).Substring(0, 3)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                If StringHandle.GetString(strLine, 3).Substring(0, 3) = "///" Then
                                Else
                                    m_ArrayMetData(p).m_Visibility = StringHandle.GetString(strLine, 3).Substring(0, 3)
                                End If
                            End If
                            p = p + 1
                        Next
                    End If
                    If mMode = "A" Then
                        For i As Integer = 1 To 12
                            If StringHandle.GetString(strLine, i).Substring(0, 3) = "///" Then
                            Else
                                m_ArrayMetData(p).m_Visibility = StringHandle.GetString(strLine, i).Substring(0, 3)
                            End If
                            p = p + 1
                        Next
                    End If
                End If
            End If
        Loop
        FileClose(1)
    End Sub
  
    ''' <summary>
    ''' 风
    ''' </summary>
    ''' <param name="FileName"></param>
    ''' <remarks></remarks>
    Private Sub FN(ByVal FileName As String)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        p = 0
        Dim str As String = ""
        Dim mMode As String = "" '方式位标志
        Dim mCheckFQ As Boolean = False '判断是否为风的数据 

        '风－－－－－－－－－－FN－－－－－－－－－－－－－－－－－－－－
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "F" And StringHandle.GetString(strLine, 1).Length <= 2 Then
                    mPointCode = "F"
                    mMode = Mid(StringHandle.GetString(strLine, 1), 2, 1)
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "D" Then
                    Exit Do
                End If
                If mPointCode = "F" Then
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If
                    '当方式位为"B"的时候
                    If mCheckFQ = True Then
                        If mMode = "N" Then
                            For i As Integer = 1 To 6
                                str = StringHandle.GetString(strLine, i).Substring(0, 3)   'PPC标志
                                If str = "PPC" Then
                                    m_ArrayMetData(p).m_Vane = 80 '为了方便用80表示静风。
                                ElseIf str = "///" Then
                                Else
                                    m_ArrayMetData(p).m_Vane = StringHandle.GetString(strLine, i).Substring(0, 3) / 10
                                End If
                                If StringHandle.GetString(strLine, i).Substring(3, 3) = "///" Then
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, i).Substring(3, 3)
                                End If
                                p = p + 1
                            Next
                            '判断是否有结果符
                            If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                                Exit Do
                            End If
                        End If

                        '当方式位为“E”的时候
                        If mMode = "E" Or mMode = "K" Then
                            For i As Integer = 1 To 6
                                str = StringHandle.GetString(strLine, i).Substring(0, 3)   'PPC标志
                                '格式的转化
                                Select Case str
                                    Case "PPC"
                                        m_ArrayMetData(p).m_Vane = 80
                                    Case "PPN"
                                        m_ArrayMetData(p).m_Vane = 0 / 10
                                    Case "NNE"
                                        m_ArrayMetData(p).m_Vane = 22.5 / 10
                                    Case "PNE"
                                        m_ArrayMetData(p).m_Vane = 45 / 10
                                    Case "ENE"
                                        m_ArrayMetData(p).m_Vane = 67.5 / 10
                                    Case "PPE"
                                        m_ArrayMetData(p).m_Vane = 90 / 10
                                    Case "ESE"
                                        m_ArrayMetData(p).m_Vane = 112.5 / 10
                                    Case "PSE"
                                        m_ArrayMetData(p).m_Vane = 135 / 10
                                    Case "SSE"
                                        m_ArrayMetData(p).m_Vane = 157.5 / 10
                                    Case "PPS"
                                        m_ArrayMetData(p).m_Vane = 180 / 10
                                    Case "SSW"
                                        m_ArrayMetData(p).m_Vane = 202.5 / 10
                                    Case "PSW"
                                        m_ArrayMetData(p).m_Vane = 225 / 10
                                    Case "WSW"
                                        m_ArrayMetData(p).m_Vane = 247.5 / 10
                                    Case "PPW"
                                        m_ArrayMetData(p).m_Vane = 270 / 10
                                    Case "WNW"
                                        m_ArrayMetData(p).m_Vane = 292.5 / 10
                                    Case "PNW"
                                        m_ArrayMetData(p).m_Vane = 315 / 10
                                    Case "NNW"
                                        m_ArrayMetData(p).m_Vane = 337.5 / 10
                                    Case "///"
                                        m_ArrayMetData(p).m_Vane = 99
                                    Case Else
                                        m_ArrayMetData(p).m_Vane = str / 10
                                End Select
                                If StringHandle.GetString(strLine, i).Substring(3, 3) = "///" Then
                                    m_ArrayMetData(p).m_WindSpeed = -9999
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, i).Substring(3, 3)
                                End If
                                p = p + 1
                            Next
                            '判断是否有结果符
                            If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                                Exit Do
                            End If
                        End If
                    End If
                    '判断是否为风的数据
                    If mPointCode = "F" Then
                        If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                            mCheckFQ = True
                        End If
                    End If
                End If
            End If
        Loop
        FileClose(1)
    End Sub

    ''' <summary>
    ''' 降水量
    ''' </summary>
    ''' <param name="FileName"></param>
    ''' <remarks></remarks>
    Private Sub RX(ByVal FileName As String)
        '当方式位为6时的降水量
        Dim strline As String = ""
        Dim mPointCode As String = ""
        p = 0
        Dim Iteam As Integer = 0 '读取第几组记录标记

        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strline <> "" Then
                If StringHandle.GetString(strline, 1).Length > 1 Then
                    If StringHandle.GetString(strline, 1).Substring(0, 2) = "R6" Then
                        mPointCode = "R6"
                        Continue Do
                    End If
                End If
                If mPointCode = "R6" Then
                    If StringHandle.GetString(strline, 1).Substring(0, 1) = "=" Then
                        Exit Do
                    End If
                    If strline = "0=" Then
                        Exit Do
                    End If
                   
                End If
                If mPointCode = "R6" And Iteam = 2 Then
                    If strline.Length = 2 Then
                        If StringHandle.GetString(strline, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strline = "" Then
                        Exit Do
                    End If
                    'For i As Integer = 0 To 23
                    '    If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                    '        If StringHandle.GetString(strline, 1).Substring(0, 4) = "////" Then
                    '        ElseIf StringHandle.GetString(strline, 1).Substring(0, 4) = ",,,," Then
                    '            m_ArrayMetData(p).m_Rainfall = 0
                    '        Else
                    '            m_ArrayMetData(p).m_Rainfall = StringHandle.GetString(strline, 1).Substring(0, 4) * 100
                    '        End If
                    '    End If
                    '    If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                    '        If StringHandle.GetString(strline, 2).Substring(0, 4) = "////" Then
                    '        ElseIf StringHandle.GetString(strline, 2).Substring(0, 4) = ",,,," Then
                    '            m_ArrayMetData(p).m_Rainfall = 0
                    '        Else
                    '            m_ArrayMetData(p).m_Rainfall = StringHandle.GetString(strline, 2).Substring(0, 4) * 100
                    '        End If
                    '    End If
                    '    If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                    '        If StringHandle.GetString(strline, 3).Substring(0, 4) = "////" Then

                    '        ElseIf StringHandle.GetString(strline, 3).Substring(0, 4) = ",,,," Then
                    '            m_ArrayMetData(p).m_Rainfall = 0
                    '        Else
                    '            m_ArrayMetData(p).m_Rainfall = StringHandle.GetString(strline, 3).Substring(0, 4) * 100
                    '        End If
                    '    End If
                    '    p = p + 1
                    'Next

                    For i As Integer = 1 To 12
                        If StringHandle.GetString(strline, i).Substring(0, 4) = "A---" Or StringHandle.GetString(strline, i).Substring(0, 4) = "----" Then
                        Else
                            If StringHandle.GetString(strline, i).Substring(0, 4) = "////" Then
                            ElseIf StringHandle.GetString(strline, i).Substring(0, 4) = ",,,," Then
                                m_ArrayMetData(p).m_Rainfall = 0
                            Else
                                m_ArrayMetData(p).m_Rainfall = StringHandle.GetString(strline, i).Substring(0, 4) * 100
                            End If
                        End If
                        p = p + 1
                    Next
                    If Mid(StringHandle.GetString(strline, 12), 5, 1) = "=" Then
                        Exit Do
                    End If
                End If
                If mPointCode = "R6" Then
                    If strline.Contains("=") Then
                        Iteam = 2
                        Continue Do
                    End If

                End If
            End If

        Loop
        FileClose(1)

    End Sub

    ''' <summary>
    ''' F 读取风的第一段数据
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub FFirst(ByVal FileName As String) ', ByVal mArrayMetData() As StructureGeneralMet)
        Dim strLine As String = ""
        Dim mPointCode As String = "" '提示码如:P或T等
        Dim mEndChar As String = "" '是否有结束符"="
        Dim mMode As String = "" '方式位标志
        Dim str As String = ""
        p = 0
        FileOpen(1, FileName, OpenMode.Input) '打开文件
        Do Until EOF(1)
            strLine = LineInput(1) '读取一行
            If strLine <> "" Then
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "F" And strLine.Length = 2 Then
                    mPointCode = "F"
                    mMode = Mid(StringHandle.GetString(strLine, 1), 2, 1) '得到某种方式位
                    Continue Do
                End If
                If StringHandle.GetString(strLine, 1).Substring(0, 1) = "D" Then
                    Exit Do
                End If
                '方式位为“H”时
                If mPointCode = "F" And mEndChar <> "=" Then
                    If strLine.Length = 2 Then
                        If StringHandle.GetString(strLine, 1).Substring(0, 1) <> mPointCode Then
                            Exit Do
                        End If
                    End If
                    If strLine = "" Then
                        Exit Do
                    End If
                    'FH的情况
                    If mMode = "H" Then
                        For i As Integer = 0 To 23
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                '格式的转化
                                str = StringHandle.GetString(strLine, 1).Substring(0, 3)   'PPC标志

                                m_ArrayMetData(p).m_Vane = GetValue(str)
                                If StringHandle.GetString(strLine, 1).Substring(3, 3) = "///" Then
                                    m_ArrayMetData(p).m_WindSpeed = -9999
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, 1).Substring(3, 3)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                                '格式的转化
                                str = StringHandle.GetString(strLine, 2).Substring(0, 3)   'PPC标志
                                m_ArrayMetData(p).m_Vane = GetValue(str)
                                If StringHandle.GetString(strLine, 2).Substring(3, 3) = "///" Then
                                    m_ArrayMetData(p).m_WindSpeed = -9999
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, 2).Substring(3, 3)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                '格式的转化
                                str = StringHandle.GetString(strLine, 3).Substring(0, 3)   'PPC标志
                                m_ArrayMetData(p).m_Vane = GetValue(str)
                                If StringHandle.GetString(strLine, 3).Substring(3, 3) = "///" Then
                                    m_ArrayMetData(p).m_WindSpeed = -9999
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, 3).Substring(3, 3)
                                End If
                            End If
                            p = p + 1
                        Next
                        '判断是否有“＝”
                        If Mid(StringHandle.GetString(strLine, 3), StringHandle.GetString(strLine, 3).Length, 1) = "=" Then
                            Exit Do
                        End If
                    End If
                    'FN的情况
                    If mMode = "N" Then
                        For i As Integer = 1 To 6
                            str = StringHandle.GetString(strLine, i).Substring(0, 3)   'PPC标志
                            If str = "PPC" Then
                                m_ArrayMetData(p).m_Vane = 80 '为了方便用80表示静风。
                            ElseIf str = "///" Then
                            Else
                                m_ArrayMetData(p).m_Vane = StringHandle.GetString(strLine, i).Substring(0, 3) / 10
                            End If
                            If StringHandle.GetString(strLine, i).Substring(3, 3) = "///" Then
                            Else
                                m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, i).Substring(3, 3)
                            End If
                            p = p + 1
                        Next
                        '判断是否有“＝”
                        If Mid(StringHandle.GetString(strLine, 6), StringHandle.GetString(strLine, 6).Length, 1) = "=" Then
                            Exit Do
                        End If
                    End If
                    '
                    ''当方式位为“E”的时候
                    If mMode = "E" Then
                        For i As Integer = 0 To 23
                            If m_ArrayMetData(p).m_DateTime.Hour = 2 Then
                                '格式的转化
                                str = StringHandle.GetString(strLine, 1).Substring(0, 3)   'PPC标志
                                m_ArrayMetData(p).m_Vane = GetValue(str)
                                If StringHandle.GetString(strLine, 1).Substring(3, 3) = "///" Then
                                    m_ArrayMetData(p).m_WindSpeed = -9999
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, 1).Substring(3, 3)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 8 Then
                                '格式的转化
                                str = StringHandle.GetString(strLine, 2).Substring(0, 3)   'PPC标志
                                m_ArrayMetData(p).m_Vane = GetValue(str)
                                If StringHandle.GetString(strLine, 2).Substring(3, 3) = "///" Then
                                    m_ArrayMetData(p).m_WindSpeed = -9999
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, 2).Substring(3, 3)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 14 Then
                                '格式的转化
                                str = StringHandle.GetString(strLine, 3).Substring(0, 3)   'PPC标志
                                m_ArrayMetData(p).m_Vane = GetValue(str)
                                If StringHandle.GetString(strLine, 3).Substring(3, 3) = "///" Then
                                    m_ArrayMetData(p).m_WindSpeed = -9999
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, 3).Substring(3, 3)
                                End If
                            End If
                            If m_ArrayMetData(p).m_DateTime.Hour = 20 Then
                                '格式的转化
                                str = StringHandle.GetString(strLine, 4).Substring(0, 3)   'PPC标志
                                m_ArrayMetData(p).m_Vane = GetValue(str)
                                If StringHandle.GetString(strLine, 4).Substring(3, 3) = "///" Then
                                    m_ArrayMetData(p).m_WindSpeed = -9999
                                Else
                                    m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, 4).Substring(3, 3)
                                End If
                            End If
                            p = p + 1
                        Next
                        '    '判断是否有结果符
                        If StringHandle.GetString(strLine, StringHandle.GetStringNumber(strLine)).Contains("=") Then
                            Exit Do
                        End If
                    End If

                    'FK的情况
                    If mMode = "K" Then
                        For i As Integer = 1 To 6
                            str = StringHandle.GetString(strLine, i).Substring(0, 3)   'PPC标志
                            If str = "PPC" Then
                                m_ArrayMetData(p).m_Vane = 80 '为了方便用80表示静风。
                            ElseIf str = "///" Then
                            Else
                                m_ArrayMetData(p).m_Vane = GetValue(StringHandle.GetString(strLine, i).Substring(0, 3))
                            End If
                            If StringHandle.GetString(strLine, i).Substring(3, 3) = "///" Then
                            Else
                                m_ArrayMetData(p).m_WindSpeed = StringHandle.GetString(strLine, i).Substring(3, 3)
                            End If
                            p = p + 1
                        Next
                        '判断是否有“＝”
                        If Mid(StringHandle.GetString(strLine, 6), StringHandle.GetString(strLine, 6).Length, 1) = "=" Then
                            Exit Do
                        End If
                    End If
                End If
            End If
        Loop
        FileClose(1)
    End Sub

    ''' <summary>
    ''' 返回方位的对应数值
    ''' </summary>
    ''' <param name="mStr"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function GetValue(ByVal mStr As String) As Double
        Dim mNumber As Double = 0
        Select Case mStr
            Case "PPC"
                mNumber = 80
            Case "PPN"
                mNumber = 0 / 10
            Case "NNE"
                mNumber = 22.5 / 10
            Case "PNE"
                mNumber = 45 / 10
            Case "ENE"
                mNumber = 67.5 / 10
            Case "PPE"
                mNumber = 90 / 10
            Case "ESE"
                mNumber = 112.5 / 10
            Case "PSE"
                mNumber = 135 / 10
            Case "SSE"
                mNumber = 157.5 / 10
            Case "PPS"
                mNumber = 180 / 10
            Case "SSW"
                mNumber = 202.5 / 10
            Case "PSW"
                mNumber = 225 / 10
            Case "WSW"
                mNumber = 247.5 / 10
            Case "PPW"
                mNumber = 270 / 10
            Case "WNW"
                mNumber = 292.5 / 10
            Case "PNW"
                mNumber = 315 / 10
            Case "NNW"
                mNumber = 337.5 / 10
            Case "///"
                mNumber = 99
            Case Else
                mNumber = mStr / 10
        End Select
        Return mNumber
    End Function

    ''' <summary>
    ''' 根据给定的时间范围，重新设置数组
    ''' </summary>
    ''' <param name="sdate"></param>
    ''' <param name="edate"></param>
    ''' <remarks></remarks>
    Public Sub ResetArrayMetData(ByVal sdate As DateTime, ByVal edate As DateTime)
        Dim A(0 To (edate - sdate).TotalHours) As StructureGeneralMet  '设置一个空数组
        Dim i As Integer
        For i = 0 To A.Length - 1
            A(i) = New StructureGeneralMet
            A(i).m_DateTime = sdate.AddHours(i)
        Next
        If m_ArrayMetData.Length = 0 Then '如果原数组为空，则
            Me.m_ArrayMetData = A
        Else
            If sdate >= m_ArrayMetData(0).m_DateTime And edate <= m_ArrayMetData(m_ArrayMetData.Length - 1).m_DateTime Then
                '如果新数组在原数组的内部，则截断原数组
                For i = 0 To A.Length - 1
                    A(i) = m_ArrayMetData(i + (sdate - m_ArrayMetData(0).m_DateTime).TotalHours)
                Next
            ElseIf sdate < m_ArrayMetData(0).m_DateTime And edate <= m_ArrayMetData(m_ArrayMetData.Length - 1).m_DateTime Then
                '如果下限超出，但上限未超出
                For i = (m_ArrayMetData(0).m_DateTime - sdate).TotalHours To A.Length - 1
                    A(i) = m_ArrayMetData(i - (m_ArrayMetData(0).m_DateTime - sdate).TotalHours)
                Next
            ElseIf sdate >= m_ArrayMetData(0).m_DateTime And edate > m_ArrayMetData(m_ArrayMetData.Length - 1).m_DateTime Then
                '如果下限未超出，但上限超出
                For i = 0 To (m_ArrayMetData(m_ArrayMetData.Length - 1).m_DateTime - sdate).TotalHours
                    A(i) = m_ArrayMetData(i + (sdate - m_ArrayMetData(0).m_DateTime).TotalHours)
                Next
            ElseIf sdate < m_ArrayMetData(0).m_DateTime And edate > m_ArrayMetData(m_ArrayMetData.Length - 1).m_DateTime Then
                '上、下限均超出
                For i = 0 To m_ArrayMetData.Length - 1
                    A(i + (m_ArrayMetData(0).m_DateTime - sdate).TotalHours) = m_ArrayMetData(i)
                Next
            End If
        End If
        Me.m_ArrayMetData = A
    End Sub
End Class
